<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

// 测试路由
Route::get('test', function () {
    return json(['msg' => 'ThinkPHP 路由正常', 'time' => date('Y-m-d H:i:s')]);
});

// 微信小程序接口路由组
Route::group('api/wechat', function () {
    // 微信登录
    Route::post('login', 'api.Wechat/login');
    // 获取手机号（需要中间件验证）
    Route::post('phone', 'api.Wechat/getPhoneNumber')->middleware(\app\middleware\WechatAuth::class);
    // 获取用户信息（需要中间件验证）
    Route::post('userinfo', 'api.Wechat/getUserInfo')->middleware(\app\middleware\WechatAuth::class);;
    // 一键授权登录
    Route::post('quickauth', 'api.Wechat/quickAuth');
});